package mock.servicesdirectory.geography.web.action;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.interceptor.ServletRequestAware;

import com.opensymphony.xwork2.ActionSupport;

public class AmendTrustRegionAction extends ActionSupport implements ServletRequestAware {
	private HttpServletRequest request;
	private int trustRegionId;
	private String trustRegionName;
	private String description;
	private int countryId;
	

	@Override
	public String execute() throws Exception {
		String txtName = (String)request.getParameter("trustRegionName");
		trustRegionName = txtName;
		String txtDes = (String)request.getParameter("description");
		description = txtDes;
		String numCountry=(String)request.getParameter("countryId");
		if(numCountry!=null){
		countryId=Integer.parseInt(numCountry);
		}
		else{
			countryId=-1;
		}
		
		String numTrustRegion=(String) request.getParameter("trustRegionId");
		if(numTrustRegion!=null){
			trustRegionId=Integer.parseInt(numTrustRegion);
		}
		else{
			trustRegionId=-1;
		}
		return SUCCESS;
	}

	public HttpServletRequest getServletRequest() {
		return request;
	}

	public void setServletRequest(HttpServletRequest request) {
		this.request = request;
	}

	public void setTrustRegionName(String trustRegionName) {
		this.trustRegionName = trustRegionName;
	}

	public String getTrustRegionName() {
		return trustRegionName;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getDescription() {
		return description;
	}

	public void setCountryId(int countryId) {
		this.countryId = countryId;
	}

	public int getCountryId() {
		return countryId;
	}

	public void setTrustRegionId(int trustRegionId) {
		this.trustRegionId = trustRegionId;
	}

	public int getTrustRegionId() {
		return trustRegionId;
	}
}
